package com.atguigu.gmall.pms.vo;

import com.atguigu.gmall.pms.entity.ProductAttrValueEntity;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.CollectionUtils;

import java.util.List;

@Data
public class BaseAttrVO extends ProductAttrValueEntity {

    public void setValueSelected(List<String> selected){
        //先判断是都为空
        if(CollectionUtils.isEmpty(selected)){
            //如果Wie空，则直接但会
            return;
        }
        //langs包下面的StringUtils,通过，的方式分割，加到里面
        this.setAttrValue(StringUtils.join(selected,","));
    }
}
